package com.xxl.job.executor.service.jobhandler;

import com.ruoyi.bizsys.service.IApplyContactsService;
import com.ruoyi.bizsys.service.IDeviceContactsService;
import com.xxl.job.core.context.XxlJobHelper;
import com.xxl.job.core.handler.annotation.XxlJob;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * 定时任务调度测试
 *
 * @author ruoyi
 */
@Slf4j
@Component
public class DeviceContactsJob {

    @Autowired
    IApplyContactsService applyContactsService;

    @Autowired
    IDeviceContactsService deviceContactsService;

    @XxlJob("checkNewTableDataJobHandler")
    public void checkNewTableData() {
        XxlJobHelper.log("通讯录分表任务 Start >>>>>>>>>>");
        applyContactsService.checkNewTableData();
        deviceContactsService.checkNewTableData();
        XxlJobHelper.log("通讯录分表任务 End >>>>>>>>>>");
    }

    @XxlJob("clearDataJobHandler")
    public void clearData() {
        XxlJobHelper.log("通讯录历史清理任务 Start >>>>>>>>>>");
        deviceContactsService.clearData();
        applyContactsService.clearData();
        XxlJobHelper.log("通讯录历史清理任务 End >>>>>>>>>>");
    }
}
